#include"tcpServer.hpp"
#include<memory>
#include "daemon.hpp"

using namespace server;
static void Usage(string proc)
{
    cout<<"\nUsage:\n\t"<<proc<<" local_port\n\n";
}

int main(int argc,char* argv[])
{
    if(argc!=2)//./tcpserver 8080
    {
        Usage(argv[0]);
    }
    uint16_t port = atoi(argv[1]);//端口号通常占用 2 字节（16位)
    unique_ptr<TcpServer> tsvr(new TcpServer(port));

    tsvr->initServer();
    daemonSelf();
    tsvr->start();
    

    return 0;
}